Skip to content

Conversation

@Quetzacoalt91
Copy link
Member

@Quetzacoalt91 Quetzacoalt91 commented May 1, 2025

Questions Answers
Description? While testing the pull-request #1327 with an OPCache too strong (invalidate_timestamps = 0 or with memory space or revalidation frequency too large), we have issues during the deletion of cache. This PR is an attempt to fix them.
Type? bug fix
BC breaks? Nope
Deprecations? Nope
Fixed ticket? /
Sponsor company @PrestaShopCorp
How to test? Use the configuration provided below and make updates (i.e 8.2.0 to 8.2.1). The process should fail during the cleanup of the store during the database update step.

Configuration of OPCache used

[OPcache]
  opcache.memory_consumption=512
  opcache.interned_strings_buffer=8
  opcache.max_accelerated_files=40000
  opcache.revalidate_freq=120
  #opcache.revalidate_freq=0
  opcache.fast_shutdown=1
  opcache.enable_cli=1

  #opcache.validate_timestamps=0

Error 1 during cleanup of XML (?) files

[2025-05-01 10:57:45] DEBUG - ChainedTasks - Step UpdateDatabase
[2025-05-01 10:57:45] INFO - UpdateDatabase - Updating database data and structure
[2025-05-01 10:57:45] DEBUG - CoreUpgrader81 - API keys not present in parameters, generating
[2025-05-01 10:57:45] DEBUG - CoreUpgrader81 - Keys generated using openssl_pkey_new, exporting private and public keys
[2025-05-01 10:57:45] DEBUG - CoreUpgrader81 - Updating parameters file
[2025-05-01 10:57:45] DEBUG - CoreUpgrader81 - Invalidating opcache for parameters file
[2025-05-01 10:57:45] DEBUG - CoreUpgrader81 - Parameters file updated
[2025-05-01 10:57:45] INFO - UpdateDatabase - Checking version validity
[2025-05-01 10:57:49] INFO - UpdateDatabase - Keeping non native modules enabled
[2025-05-01 10:57:49] INFO - CoreUpgrader - Running generic queries
[2025-05-01 10:57:49] INFO - CoreUpgrader - Database update OK
[2025-05-01 10:57:49] INFO - CoreUpgrader - Updating languages
[2025-05-01 10:57:49] DEBUG - CoreUpgrader80 - Downloading language pack for en
[2025-05-01 10:57:49] DEBUG - CoreUpgrader80 - Installing en language pack
[2025-05-01 10:57:49] DEBUG - CoreUpgrader80 - Generating mail templates for en
[2025-05-01 10:57:52] DEBUG - CoreUpgrader80 - Downloading language pack for fr
[2025-05-01 10:57:53] DEBUG - CoreUpgrader80 - Installing fr language pack
[2025-05-01 10:57:53] DEBUG - CoreUpgrader80 - Generating mail templates for fr
[2025-05-01 10:57:55] INFO - CoreUpgrader - Regenerating htaccess
[2025-05-01 10:57:55] INFO - CoreUpgrader - Cleaning XML files
[2025-05-01 10:57:55] CRITICAL - ErrorHandler - /var/www/html/modules/autoupgrade/vendor/symfony/filesystem/Filesystem.php line 183 - Symfony\Component\Filesystem\Exception\IOException: Failed to remove file "/var/www/html/var/cache/dev/class_index.php": unlink(/var/www/html/var/cache/dev/class_index.php): No such file or directory
#0 /var/www/html/modules/autoupgrade/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php(722): Symfony\Component\Filesystem\Filesystem->remove(Array)
#1 /var/www/html/modules/autoupgrade/classes/UpgradeTools/CoreUpgrader/CoreUpgrader.php(131): PrestaShop\Module\AutoUpgrade\UpgradeTools\CoreUpgrader\CoreUpgrader->cleanXmlFiles()
#2 /var/www/html/modules/autoupgrade/classes/Task/Update/UpdateDatabase.php(73): PrestaShop\Module\AutoUpgrade\UpgradeTools\CoreUpgrader\CoreUpgrader->finalizeCoreUpdate()
#3 /var/www/html/modules/autoupgrade/classes/Task/Runner/ChainedTasks.php(65): PrestaShop\Module\AutoUpgrade\Task\Update\UpdateDatabase->run()
#4 /var/www/html/**admin_folder**/autoupgrade/ajax-upgradetab.php(54): PrestaShop\Module\AutoUpgrade\Task\Runner\ChainedTasks->run()
#5 {main}

Error 2 during cleaning of folders

/var/www/html/modules/autoupgrade/vendor/symfony/filesystem/Filesystem.php line 180 - Symfony\Component\Filesystem\Exception\IOException: Failed to remove directory "/var/www/html/var/cache//prod": rmdir(/var/www/html/var/cache//prod): Directory not empty
#0 /var/www/html/modules/autoupgrade/classes/UpgradeTools/FilesystemAdapter.php(249): Symfony\Component\Filesystem\Filesystem->remove(Array)
#1 /var/www/html/modules/autoupgrade/classes/UpgradeTools/CacheCleaner.php(74): PrestaShop\Module\AutoUpgrade\UpgradeTools\FilesystemAdapter->clearDirectory('/var/www/html/v...')
#2 /var/www/html/modules/autoupgrade/classes/Task/Update/UpdateDatabase.php(113): PrestaShop\Module\AutoUpgrade\UpgradeTools\CacheCleaner->cleanFolders()
#3 /var/www/html/modules/autoupgrade/classes/Task/Runner/ChainedTasks.php(62): PrestaShop\Module\AutoUpgrade\Task\Update\UpdateDatabase->init()
#4 /var/www/html/admin-dev/autoupgrade/ajax-upgradetab.php(53): PrestaShop\Module\AutoUpgrade\Task\Runner\ChainedTasks->run()
#5 {main}
It seems there was an issue with the server. This type of error usually happens when:
        The server is temporarily unavailable.
        There's a misconfiguration or unexpected problem on the server.
HTTP request failed. Type: ERR_BAD_RESPONSE - HTTP Code: 500

@Quetzacoalt91 Quetzacoalt91 self-assigned this May 1, 2025
@Quetzacoalt91 Quetzacoalt91 added the bug Type: Bug fix label May 1, 2025
@github-project-automation github-project-automation bot moved this to Ready for review in PR Dashboard May 1, 2025
@Quetzacoalt91 Quetzacoalt91 force-pushed the fix-issues-during-unlink branch from 445b9d0 to 928ecc8 Compare May 1, 2025 10:45
@sonarqubecloud
Copy link

sonarqubecloud bot commented May 1, 2025

@github-project-automation github-project-automation bot moved this from Ready for review to Closed in PR Dashboard May 13, 2025
@ga-devfront ga-devfront reopened this Jun 16, 2025
@ps-jarvis ps-jarvis moved this from Closed to Reopened in PR Dashboard Jun 16, 2025
@ga-devfront ga-devfront marked this pull request as ready for review June 16, 2025 13:35
@ga-devfront ga-devfront force-pushed the fix-issues-during-unlink branch from 928ecc8 to 1f617a5 Compare June 16, 2025 13:48
@sonarqubecloud
Copy link

@Quetzacoalt91 Quetzacoalt91 added this to the 7.2.0 milestone Jun 17, 2025
Copy link
Contributor

@AureRita AureRita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Quetzacoalt91

Thank you for your PR, I tested it and it seems to works as you can see :

Capture.video.du.2025-06-19.12-12-28.mp4

Tested from :
8.2 to 9.0.0 with php 8.1
8.2 to 8.2.1 with php 7.2

Because the PR seems to works as expected, It's QA ✔️

Thank you

@Quetzacoalt91 Quetzacoalt91 merged commit 5fe5b35 into PrestaShop:dev Jun 27, 2025
38 checks passed
@github-project-automation github-project-automation bot moved this from Reopened to Merged in PR Dashboard Jun 27, 2025
@Quetzacoalt91 Quetzacoalt91 deleted the fix-issues-during-unlink branch June 27, 2025 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Type: Bug fix QA ✔️

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants